GTK_EVENT_SEQUENCE_DENIED
} GtkEventSequenceState;
-typedef enum {
- GTK_CROSSING_FOCUS,
- GTK_CROSSING_POINTER
-} GtkCrossingType;
-
-typedef enum {
- GTK_CROSSING_IN,
- GTK_CROSSING_OUT
-} GtkCrossingDirection;
-
/**
* GtkPanDirection:
* @GTK_PAN_DIRECTION_LEFT: panned towards the left
#define GTK_EVENT_CONTROLLER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_EVENT_CONTROLLER, GtkEventControllerClass))
-typedef struct _GtkCrossingData GtkCrossingData;
-
-/**
- * GtkCrossingData:
- * @type: the type of crossing event
- * @direction: whether this is a focus-in or focus-out event
- * @mode: the crossing mode
- * @old_target: the old target
- * @old_descendent: the direct child of the receiving widget that
- * is an ancestor of @old_target, or %NULL if @old_target is not
- * a descendent of the receiving widget
- * @new_target: the new target
- * @new_descendent: the direct child of the receiving widget that
- * is an ancestor of @new_target, or %NULL if @new_target is not
- * a descendent of the receiving widget
- *
- * The struct that is passed to gtk_event_controller_handle_crossing().
- *
- * The @old_target and @new_target fields are set to the old or new
- * focus or hover location.
- */
-struct _GtkCrossingData {
- GtkCrossingType type;
- GtkCrossingDirection direction;
- GdkCrossingMode mode;
- GtkWidget *old_target;
- GtkWidget *old_descendent;
- GtkWidget *new_target;
- GtkWidget *new_descendent;
-};
-
GDK_AVAILABLE_IN_ALL
GType gtk_crossing_data_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_event_controller_get_widget (GtkEventController *controller);
-GDK_AVAILABLE_IN_ALL
-gboolean gtk_event_controller_handle_event (GtkEventController *controller,
- GdkEvent *event,
- GtkWidget *target,
- double x,
- double y);
-GDK_AVAILABLE_IN_ALL
-void gtk_event_controller_handle_crossing (GtkEventController *controller,
- const GtkCrossingData *crossing,
- double x,
- double y);
GDK_AVAILABLE_IN_ALL
void gtk_event_controller_reset (GtkEventController *controller);
{
GtkEventController parent_instance;
- const GtkCrossingData *current_crossing;
-
guint is_focus : 1;
guint contains_focus : 1;
};
double x,
double y)
{
- GtkEventControllerFocus *focus = GTK_EVENT_CONTROLLER_FOCUS (controller);
-
- if (crossing->type != GTK_CROSSING_FOCUS)
- return;
-
- focus->current_crossing = crossing;
-
- update_focus (controller, crossing);
-
- focus->current_crossing = NULL;
+ if (crossing->type == GTK_CROSSING_FOCUS)
+ update_focus (controller, crossing);
}
static void
return g_object_new (GTK_TYPE_EVENT_CONTROLLER_FOCUS, NULL);
}
-/**
- * gtk_event_controller_focus_get_focus_origin:
- * @controller: a #GtkEventControllerFocus
- *
- * Returns the widget that was holding focus before.
- *
- * This function can only be used in handlers for the
- * #GtkEventControllerFocus::focus-in and #GtkEventControllerFocus::focus-out signals.
- *
- * Returns: (transfer none): the previous focus
- */
-GtkWidget *
-gtk_event_controller_focus_get_focus_origin (GtkEventControllerFocus *controller)
-{
- g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_FOCUS (controller), NULL);
- g_return_val_if_fail (controller->current_crossing != NULL, NULL);
-
- return controller->current_crossing->old_target;
-}
-
-/**
- * gtk_event_controller_focus_get_focus_target:
- * @controller: a #GtkEventControllerFocus
- *
- * Returns the widget that will be holding focus afterwards.
- *
- * This function can only be used in handlers for the
- * #GtkEventControllerFocus::focus-in and #GtkEventControllerFocus::focus-out signals.
- *
- * Returns: (transfer none): the next focus
- */
-GtkWidget *
-gtk_event_controller_focus_get_focus_target (GtkEventControllerFocus *controller)
-{
- g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_FOCUS (controller), NULL);
- g_return_val_if_fail (controller->current_crossing != NULL, NULL);
-
- return controller->current_crossing->new_target;
-}
-
-GtkWidget *
-gtk_event_controller_focus_get_old_focus_child (GtkEventControllerFocus *controller)
-{
- g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_FOCUS (controller), NULL);
- g_return_val_if_fail (controller->current_crossing != NULL, NULL);
-
- return controller->current_crossing->old_descendent;
-}
-
-GtkWidget *
-gtk_event_controller_focus_get_new_focus_child (GtkEventControllerFocus *controller)
-{
- g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_FOCUS (controller), NULL);
- g_return_val_if_fail (controller->current_crossing != NULL, NULL);
-
- return controller->current_crossing->new_descendent;
-}
-
/**
* gtk_event_controller_focus_contains_focus:
* @self: a #GtkEventControllerFocus
GDK_AVAILABLE_IN_ALL
GtkEventController *gtk_event_controller_focus_new (void);
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_event_controller_focus_get_focus_origin (GtkEventControllerFocus *controller);
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_event_controller_focus_get_focus_target (GtkEventControllerFocus *controller);
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_event_controller_focus_get_old_focus_child (GtkEventControllerFocus *controller);
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_event_controller_focus_get_new_focus_child (GtkEventControllerFocus *controller);
-
GDK_AVAILABLE_IN_ALL
gboolean gtk_event_controller_focus_contains_focus (GtkEventControllerFocus *self);
GDK_AVAILABLE_IN_ALL
NULL);
}
-/**
- * gtk_event_controller_motion_get_pointer_origin:
- * @controller: a #GtkEventControllerMotion
- *
- * Returns the widget that contained the pointer before.
- *
- * This function can only be used in handlers for the
- * #GtkEventControllerMotion::enter or
- * #GtkEventControllerMotion::leave signals.
- *
- * Returns: (transfer none): the previous pointer focus
- */
-GtkWidget *
-gtk_event_controller_motion_get_pointer_origin (GtkEventControllerMotion *controller)
-{
- g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_MOTION (controller), NULL);
- g_return_val_if_fail (controller->current_crossing != NULL, NULL);
-
- return controller->current_crossing->old_target;
-}
-
-/**
- * gtk_event_controller_motion_get_pointer_target:
- * @controller: a #GtkEventControllerMotion
- *
- * Returns the widget that will contain the pointer afterwards.
- *
- * This function can only be used in handlers for the
- * #GtkEventControllerMotion::enter or
- * #GtkEventControllerMotion::leave signals.
- *
- * Returns: (transfer none): the next pointer focus
- */
-GtkWidget *
-gtk_event_controller_motion_get_pointer_target (GtkEventControllerMotion *controller)
-{
- g_return_val_if_fail (GTK_IS_EVENT_CONTROLLER_MOTION (controller), NULL);
- g_return_val_if_fail (controller->current_crossing != NULL, NULL);
-
- return controller->current_crossing->new_target;
-}
-
/**
* gtk_event_controller_motion_contains_pointer:
* @self: a #GtkEventControllerMotion
GDK_AVAILABLE_IN_ALL
GtkEventController *gtk_event_controller_motion_new (void);
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_event_controller_motion_get_pointer_origin (GtkEventControllerMotion *controller);
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_event_controller_motion_get_pointer_target (GtkEventControllerMotion *controller);
-
GDK_AVAILABLE_IN_ALL
gboolean gtk_event_controller_motion_contains_pointer (GtkEventControllerMotion *self);
GDK_AVAILABLE_IN_ALL
#include "gtkeventcontroller.h"
+typedef enum {
+ GTK_CROSSING_FOCUS,
+ GTK_CROSSING_POINTER
+} GtkCrossingType;
+
+typedef enum {
+ GTK_CROSSING_IN,
+ GTK_CROSSING_OUT
+} GtkCrossingDirection;
+
+typedef struct _GtkCrossingData GtkCrossingData;
+
+/**
+ * GtkCrossingData:
+ * @type: the type of crossing event
+ * @direction: whether this is a focus-in or focus-out event
+ * @mode: the crossing mode
+ * @old_target: the old target
+ * @old_descendent: the direct child of the receiving widget that
+ * is an ancestor of @old_target, or %NULL if @old_target is not
+ * a descendent of the receiving widget
+ * @new_target: the new target
+ * @new_descendent: the direct child of the receiving widget that
+ * is an ancestor of @new_target, or %NULL if @new_target is not
+ * a descendent of the receiving widget
+ *
+ * The struct that is passed to gtk_event_controller_handle_crossing().
+ *
+ * The @old_target and @new_target fields are set to the old or new
+ * focus or hover location.
+ */
+struct _GtkCrossingData {
+ GtkCrossingType type;
+ GtkCrossingDirection direction;
+ GdkCrossingMode mode;
+ GtkWidget *old_target;
+ GtkWidget *old_descendent;
+ GtkWidget *new_target;
+ GtkWidget *new_descendent;
+};
+
struct _GtkEventController
{
GObject parent_instance;
GtkWidget *gtk_event_controller_get_target (GtkEventController *controller);
+gboolean gtk_event_controller_handle_event (GtkEventController *controller,
+ GdkEvent *event,
+ GtkWidget *target,
+ double x,
+ double y);
+void gtk_event_controller_handle_crossing (GtkEventController *controller,
+ const GtkCrossingData *crossing,
+ double x,
+ double y);
+
#endif /* __GTK_EVENT_CONTROLLER_PRIVATE_H__ */
#include "gtkactionmuxerprivate.h"
#include "gtkcontainer.h"
#include "gtkcsstypesprivate.h"
-#include "gtkeventcontroller.h"
+#include "gtkeventcontrollerprivate.h"
#include "gtklistlistmodelprivate.h"
#include "gtkrootprivate.h"
#include "gtksizerequestcacheprivate.h"